package com.hdyg.sixg.adapter;

import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.hdyg.sixg.R;
import com.hdyg.sixg.entry.AppealBean;

import java.util.List;

/**
 * @author CZB
 * @describe 申诉记录适配器
 * @time 2019/3/20 14:22
 */
public class AppealRecordAdapter extends BaseQuickAdapter<AppealBean.ListBean, BaseViewHolder> {
    public AppealRecordAdapter(int layoutResId, @Nullable List<AppealBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AppealBean.ListBean item) {
        helper.setText(R.id.tv_content, item.getContent());
        helper.setText(R.id.tv_time, item.getCreated_at());
        String replay = String.format(mContext.getResources().getString(R.string.appeal_replay), item.getReplay());
        helper.setText(R.id.tv_reply, replay);
        RecyclerView recyclerView = helper.getView(R.id.rv_image);
        recyclerView.setLayoutManager(new GridLayoutManager(mContext, 3));
        if (item.getPicture() != null && item.getPicture().size() > 0) {
            CertifAdapter adapter = new CertifAdapter(R.layout.item_take_photo, item.getPicture());
            adapter.setHideDeleteImg(true);
            recyclerView.setAdapter(adapter);
        }

    }
}
